#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2025/04/15 13:22
# @File           : room.py
# @IDE            : PyCharm
# @desc           : pydantic 模型，用于数据库序列化操作

from pydantic import BaseModel, Field, ConfigDict
from core.data_types import DatetimeStr
from typing import List
from apps.device.camera.schemas.camera import CameraSimpleOut


class Room(BaseModel):
    name: str = Field(..., title="房间名称，唯一标识")
    type: str = Field("residential", title="房间类型，医院或住宅")
    location: str = Field(..., title="房间位置，详细地址")


class RoomSimpleOut(Room):
    model_config = ConfigDict(from_attributes=True)

    id: int = Field(..., title="编号")
    create_datetime: DatetimeStr = Field(..., title="创建时间")
    update_datetime: DatetimeStr = Field(..., title="更新时间")


class RoomOut(Room):
    model_config = ConfigDict(from_attributes=True)

    id: int = Field(..., title="编号")
    create_datetime: DatetimeStr = Field(..., title="创建时间")
    update_datetime: DatetimeStr = Field(..., title="更新时间")

    cameras: List[CameraSimpleOut] = []
